#!/bin/bash

#保存默认的分隔符
IFSOLD=$IFS

#将分隔符设定为'\n' 默认是空格
IFS=$'\n'
#分隔符可以选择多个，直接连接到后面
#IFS=$'\n':

for file in `ls -l $HOME`
do
    echo $file
done

#还原默认分隔符
IFS=$IFSOLD


for file in $HOME/*
do
    if file -d "$file"
    then
        echo "$file is directory"
    elif file -f "$file"
    then
        echo "$file is a file"
    fi
done
#!/bin/bash


#c风格的for语句
for (( i = 1,j = 10; i <= 10;i++,j--)) 
do
    echo "the next number is $i  $j"
done
